<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%
  add_crumb(@quiz.quiz_title, context_url(@context, :context_quiz_url, @quiz))
  content_for :page_title, join_title(@quiz.quiz_title, @context.name)
  css_bundle :quizzes
  js_bundle :quizzes_bundle
%>

<div style="width: 600px; margin: 10px auto;">
  <h2><%= @quiz.quiz_title || @quiz.readable_type %></h2>
  <p><% if @quiz.survey? %>
    {{#t}}This survey is restricted by an access code. You'll need to ask your teacher or proctor to type in or tell you the access code in order to take the survey.{{/t}}
  <% else %>
    {{#t}}This quiz is restricted by an access code. You'll need to ask your teacher or proctor to type in or tell you the access code in order to take the quiz.{{/t}}
  <% end %></p>
  <%= form_tag request.url, :class => "access_code_form", :method => :post do %>
    <% if params[:preview] && can_do(@quiz, @current_user, :update) %>
      <input type="hidden" name="preview" value="1"/>
    <% end %>
    <label for="quiz_access_code" style="font-size: 1.2em;"><%= before_label(:access_code, "Access Code") %></label>
    <input type="password" name="access_code" style="font-size: 1.2em;" title="<%= before_label(:access_code, "Access Code") %>" id="quiz_access_code"/>
    <button class="btn" type="submit" class="btn btn-large">{{#t}}Submit{{/t}}</button>
  <% end %>
</div>
